From: robertl Date: Sun, 6 Jun 2010 00:49:08 +0000 (+0000) Subject: Improve translation for Mac; now reads .qms from the bundle. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~17^2~22 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5ca35af3302e8eb191fe5f377be09a55e4a5b6ff;p=gpsbabel.git Improve translation for Mac; now reads .qms from the bundle. --- diff --git a/gui/gpsbabelfe_it.qm b/gui/gpsbabelfe_it.qm index fb51620fc..ce06aba78 100644 Binary files a/gui/gpsbabelfe_it.qm and b/gui/gpsbabelfe_it.qm differ diff --git a/gui/gpsbabelfe_it.ts b/gui/gpsbabelfe_it.ts index bfccd95ac..c7d588eaf 100644 --- a/gui/gpsbabelfe_it.ts +++ b/gui/gpsbabelfe_it.ts @@ -459,7 +459,7 @@ This program cannot continue. waypoints - + @@ -520,7 +520,7 @@ This program cannot continue. Translation successful - + Translation Opzioni @@ -632,7 +632,7 @@ This program cannot continue. Translation Options - + Translation Opzioni @@ -649,7 +649,7 @@ This program cannot continue. Waypoints - Punti di interesse + Punti di interesse @@ -659,7 +659,7 @@ This program cannot continue. Routes - Rotte + Rotte @@ -669,7 +669,7 @@ This program cannot continue. Tracks - Tracce + Tracce @@ -694,7 +694,7 @@ This program cannot continue. Output - Destinazione + Destinazione diff --git a/gui/main.cpp b/gui/main.cpp index dd3a46f9b..822184508 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: main.cpp,v 1.7 2010/05/19 11:41:02 robertl Exp $ +// $Id: main.cpp,v 1.8 2010/06/06 00:49:08 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -37,15 +37,32 @@ const char *pathSeparator = ";"; const char *pathSeparator = ":"; #endif +#if defined (Q_OS_MAC) +#include +#endif + //------------------------------------------------------------------------ static void installTranslation(QApplication *app, const QString &nm) { QTranslator *xlator = new QTranslator(); -fprintf(stderr, "Loading %s\n", qPrintable(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + nm + QLocale::system().name())); + xlator->load(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + nm + QLocale::system().name()); -fprintf(stderr, "...Loading %s\n", qPrintable(nm + QLocale::system().name())); xlator->load(nm + QLocale::system().name()); + +#if defined (Q_OS_MAC) + CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, + kCFURLPOSIXPathStyle); + QString pathPtr(CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding())); + pathPtr += "/Contents/MacOS/lang/" + nm; + // pathPtr += QLocale::system().name().left(2); + pathPtr += QLocale::system().name(); + + xlator->load(pathPtr); + +#endif + app->installTranslator(xlator); } diff --git a/tools/mac-localize b/tools/mac-localize new file mode 100755 index 000000000..f34e72027 --- /dev/null +++ b/tools/mac-localize @@ -0,0 +1,12 @@ +# Creating even empty (?!?!) directories is enough to trigger the merge +# of the trnslations for the application menu. This isn't as ambitious +# as described at +# http://doc.qt.nokia.com/4.6/mac-differences.html#translating-the-application-menu-and-native-dialogs +# but at least for German, it seems to work. +# + +cd gui +for i in $(echo gpsbabelfe_??.ts | sed 's/gpsbabelfe_\(..\).ts/\1/g') +do + mkdir objects/gpsbabelfe-bin.app/Contents/Resources/$i.lproj +done